package com.yiqi.lottery.feature.home.model;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.suozhang.framework.entity.bo.UserInfoBo;
import com.yiqi.lottery.entity.bo.*;
import com.yiqi.lottery.feature.home.contract.PayContract;
import com.yiqi.lottery.feature.home.dependencies.DaggerPayModelComponent;
import com.yiqi.lottery.feature.mine.contract.MineContract;
import com.yiqi.lottery.feature.mine.dependencies.mine.DaggerMineModelComponent;
import com.yiqi.lottery.framework.api.ApiLib;
import com.yiqi.lottery.framework.api.UserApi;

import java.util.HashMap;

import io.reactivex.Observable;

import javax.inject.Inject;

public class PayModel implements PayContract.Model {

    @Inject
    UserApi api;


    @Inject
    public PayModel() {

        DaggerPayModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }

    @Override
    public Observable<UserInfoBo> getUsertInfo() {
        return api.getUserInfo().compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> createOrder(OrderBo orderBo) {
        return api.createOrder(orderBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> orderOptimiz(HashMap<String,Object> map) {
        return api.orderOptimiz(map).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> createCopurch(HashMap<String, Object> couprceBo) {
        return api.createCopurch(couprceBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }



    @Override
    public Observable<String> followOrder(OrderBo orderId) {
        return api.followOrder(orderId).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> billingOrder(String order_id,HashMap<String, String> content) {
        return api.billingOrder(order_id,content).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }


}
